<template>
	<div class="user">
		<commonUserinfo :userInfoData="{userItemIndex:itemIndex,userLeftHeight:userLeftHeight,$parent:$parent}">
			<div class="user_main_right f_left text_center">
				<div class="user_right_tip">
					温馨提示：在线报名和继续教育<br>
					报名之前必须先完善个人信息
				</div>
				<div class="user_userInfo color666">
					<dl>
						<dt class="f_left">真实姓名：</dt>
						<dd class="f_left">{{form.realName}}</dd>
					</dl>
					<dl>
						<dt class="f_left">身份证号：</dt>
						<dd class="f_left">{{form.remark}}</dd>
					</dl>
					<dl>
						<dt class="f_left">手机号码：</dt>
						<dd class="f_left">{{form.encryptTelphone}}</dd>
					</dl>
					<dl>
						<dt class="f_left">所在企业：</dt>
						<dd class="f_left">{{form.companyName}}</dd>
					</dl>
				</div>

				<el-button type="primary" class="my_modify" @click="isModify = true">申请修改企业</el-button>
                <p style="color: #ff0000;margin-top: 30px;">注：申请修改的信息将在审核通过后再新的报名中体现，审核结果请在<router-link to="/cont_education/user/business_center">业务中心</router-link>查看申请结果。</p>
				<el-dialog title="申请修改企业" :visible.sync="isModify">
					<el-form :model="form">
						<el-form-item label="企业名称" :label-width="formLabelWidth">
							<el-input v-model="modifyInfo.companyName" placeholder="请输入要修改企业的完整名称"></el-input>
						</el-form-item>
					</el-form>
					<div slot="footer" class="dialog-footer">
						<el-button @click="isModify = false">取 消</el-button>
						<el-button type="primary" @click="modifyDefine()">确 定</el-button>
					</div>
				</el-dialog>
			</div>
		</commonUserinfo>
	</div>
</template>

<script>
	import commonUserinfo from '../../../components/cont_education/c_userinfo.vue'
	export default {
		name: "user_info",
		data() {
			return {
				form: {},
				itemIndex: 0,
				userLeftHeight: '',
				isModify: false,
				formLabelWidth: '120px',
				modifyInfo: {
					companyName: ''
				}
			}
		},
		created: function() {
			var that = this;
			this.common.post(this.api.getMyInfo, {}, function(res) {
				that.form = res.resultMap;
			});
		},
		methods: {
			modifyDefine(){
				if(this.modifyInfo.companyName == ""){
					this.$message.error('请输入企业名称！')
					return
				}
				this.common.post(this.api.applyChangeCompany, this.modifyInfo, res => {
					this.$message.success(res.resultMap);
					this.isModify = false;
                    this.modifyInfo.companyName="";
                }, error => {
                    this.$message.error(error.resultMsg);
                });
			}
		},
		components: {
			commonUserinfo
		}
	}
</script>

<style>
	.my_modify{
		margin-top: 30px;
	}
</style>
